package com.zf.shuashua.ui.follow;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zf.shuashua.R;
import com.zf.shuashua.bean.VideoInfo;

public class FollowAdapter extends BaseQuickAdapter<VideoInfo, BaseViewHolder> {

    private Context context;

    public FollowAdapter(Context context, int layoutResId) {
        super(layoutResId);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, VideoInfo data) {
        Glide.with(context)
                .load(data.getAvatar())
                .placeholder(R.mipmap.ic_launcher)
                .into((ImageView) (helper.getView(R.id.video_pic)));
       /* Glide.with(context)
                .load(data.getUser().getAvatar())
                .placeholder(R.mipmap.ic_launcher)
                .into((ImageView) (helper.getView(R.id.user_photo)));*/

        RequestOptions requestOptions = RequestOptions.circleCropTransform();
        Glide.with(mContext).load(data.getUser().getAvatar()).apply(requestOptions)
                .placeholder(R.mipmap.ic_launcher).
                into( (ImageView) (helper.getView(R.id.user_photo)));


        helper.setText(R.id.user_name, data.getUser().getName());
        helper.setText(R.id.time, data.getCreated_time());
    }

}
